/***********************************************************************
 *
 * MODULE NAME:    hfp_at.h
 * DESCRIPTION:    hfp at command
 * AUTHOR:         Martin Mellody
 *
 * SOURCE CONTROL: $Id: hfp.h,v 1.1 2008/01/03 06:55:12 tianwq Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2000-2011 RDA Microelectronics.
 *     All rights reserved.
 *
 ***********************************************************************/
#ifndef __HFP_AT_H__
#define __HFP_AT_H__

/********************************************************************
 * Operation codes used to indicate what AT Command / USR is pending
 ********************************************************************/
enum {
    /* standard at command */
    AT_OK = 0,
    AT_ERROR,
    AT_RING,
    AT_ANSWER,
    AT_DIAL,
    AT_CCWA,
    AT_CHLD,
    AT_CHUP,
    AT_CIEV,
    AT_CIND,
    AT_CLCC,
    AT_CLIP,
    AT_CME,
    AT_CMEE,
    AT_CMER,
    AT_CNUM,
    AT_COPS,
    AT_VTS,
    
    AT_BINP,
    AT_BLDN,
    AT_BSIR,
    AT_BTRH,
    AT_BVRA,
    AT_BRSF,
    AT_NREC,
    AT_VGM,
    AT_VGS,
    AT_CKPD,
    AT_XAPL,

    AT_CLIP_0,
    AT_CLIP_1,
    AT_CIEV_3001,
    AT_CIEV_3000,
    AT_CIND_TEST,
    AT_NREC_0,
    AT_BRVA_0,
    AT_BRVA_1,
    AT_CCWA_0,
    AT_CCWA_1,
    AT_CHLD_TEST,
    AT_UNKNOWN = 0xffff
};

/* message type defines */
#define HFP_AT_PARAM_NONE           0x0000      // no parameters
#define HFP_AT_PARAM_ONE            0x0100      // one param     
#define HFP_AT_PARAM_TWO            0x0200      // two param     
#define HFP_AT_PARAM_TEST           0x0d00      // add =?
#define HFP_AT_PARAM_READ           0x0e00      // add ?
#define HFP_AT_PARAM_RAW            0x0f00      // raw param     


/* read number from the buff, return the char len */
int HF_AT_Read_Number(char *buff, u_int *pValue);
/* write number to the buff, return the char len */
int HF_AT_Write_Number(char *buff, u_int value);

/* build and send at command */
int HF_AT_Send(u_int16 atcode, u_int param1, u_int param2, char *raw);
/* handle at command from ag, implement in hfp_hs.c */
int HF_HS_Handle_AT_From_AG(u_int16 atcode, u_int param1, u_int param2, char *raw);
/* handle at command from hs, implement in hfp_ag.c */
int HF_AG_Handle_AT_From_HS(u_int16 atcode, u_int param1, u_int param2, char *raw);
/* decode at command */
int HF_AT_Decode_Command(char* buffer);

#endif


